<template>
    <div class="bg relative">
        <div class="close" @click="close">
            ×
        </div>
        <div class="px-64px mx-auto flex flex-col items-center justify-center">
            <p class="text-24px font-bold lh-42px mt-12px">欢迎您!新成员!</p>
            <p class="text-12px lh-21px">
                输入下列资料申请成为发布者
            </p>
            <div class="form-item">
                <nut-input v-model="formData.nickname" placeholder="发布者名称"></nut-input>
                <div>请输入您的使用者名称</div>
            </div>
            <div class="form-item">
                <nut-input v-model="formData.email" placeholder="联系邮箱"></nut-input>
                <div>请输入正确的邮箱地址</div>
            </div>
            <div class="form-item">
                <nut-input v-model="formData.other_contacts" placeholder="其他联系方式"></nut-input>
                <div>请输入您的其他联系方式</div>
            </div>
            <div class="form-item">
                <nut-input v-model="formData.describes" placeholder="游戏资源说明" class="!h-196px"></nut-input>
                <div>请详述您的游戏资源内容</div>
            </div>

            <nut-button class="!h-33px !w-full !bg-#000 !border-none !text-#fff !font-bold !mt-23px !mb-29px !text-12px"
                        @click="submit">
                提交注册
            </nut-button>

            <div class="text-8px text-center lh-16px mb-20px">
                <p>注册即表示您确认您已年满18岁并接受我们的 <strong>使用规定</strong> 及 <strong>隐私权声明</strong> </p>
                <p>本站接受RECAPTCHA以及GOOGLE隐私声明和服务条款保护</p>
                <p>
                    <strong>隐私权声明</strong>
                    及
                    <strong>服务条款</strong>
                </p>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { axiosService } from '@/http/sever'
import { showNotify } from '@nutui/nutui'

const emit = defineEmits(['close'])

const formData = ref({
    nickname: '',
    email: '',
    other_contacts: '',
    describes: ''
})

const close = () => {
    emit('close')
}

const submit = () => {
    axiosService.post('/api/publisher/Index/addPublisher', formData.value).then(res => {
        showNotify.success('提交成功')
        close()
    }).catch(err => {
        showNotify.danger(err.msg)
    })
}
</script>

<style lang="scss" scoped>
.bg {
    background: url(../images/gradient-overlay.webp) no-repeat center center;
    background-size: 100% 100%;
}

.close {
    border: 1px solid #fff;
    border-radius: 3px;
    width: 25px;
    height: 25px;
    text-align: center;
    line-height: 25px;
    font-size: 20px;
    position: absolute;
    right: 15px;
    top: 20px;
}

.form-item {
    width: 100%;

    :deep(.nut-input) {
        height: 38px;
        border-radius: 5px;
        padding-left: 12px;
        width: 100% !important;

        input {
            color: #000;

            &::placeholder {
                color: #b3b3b3;
            }
        }
    }

    &>div {
        color: #ffdae2;
        font-size: 9px;
        line-height: 12px;
        margin: 4px 0;
        margin-left: 12px;
    }
}
</style>
